package com.itheima03;

import java.io.*;
import java.net.Socket;

public class KeHuDuan {
    public static void main(String[] args) throws IOException {
        Socket socket=new Socket("127.0.0.1",10000);



        BufferedWriter bufferedWriter=new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
        BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(socket.getInputStream()));

        bufferedWriter.write("你好，服务器");
        bufferedWriter.newLine();
        bufferedWriter.flush();

        socket.shutdownOutput();

        String line = bufferedReader.readLine();
        System.out.println("服务器返回："+line);

        socket.close();
    }
}
